home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #6 / Amiga Plus CD - 2004 - No. 06.iso / AmigaPlus / Begleitmaterial / 50Tools / Grafik / PerfectPaint / rexx / box / AnimPainting_Box.rx < prev    next >
Text File  |  1999-12-09  |  2KB  |  117 lines

  1. /* Script Rexx
  2.     AnimPainting for Box*/
  3.  
  4.     call addlib("rexxmathlib.library", 5, -30, 0)
  5.  
  6.     options results
  7.   parse ARG Port x1 y1 x2 y2 b
  8.  
  9.     ADDRESS COMMAND
  10.     sens=0
  11.     if EXISTS('PerfectPaint:Prefs/Rexx_Prefs/AnimPainting_Box') THEN DO
  12.         IF OPEN('lfile','PerfectPaint:Prefs/Rexx_Prefs/AnimPainting_Box', "R") then DO
  13.             sens = READLN('lfile')
  14.             CALL CLOSE('lfile')
  15.         END
  16.     END
  17.  
  18.     ADDRESS value Port
  19.     pp_DialogInit 250 60 "*AnimPainting*Box*" 1
  20.         pp_Cycle 0 100 8 100 16 "Order" 1 "--->|<---" sens
  21.     pp_Dialog
  22.     rc=result
  23.     if rc=0 then
  24.         do
  25.             EXIT
  26.         end        
  27.  
  28.     pp_GetDialog 0
  29.     sens=result
  30.  
  31.     CALL SavePrefs('AnimPainting_Box',sens)
  32.     ADDRESS value Port
  33.  
  34. IF x1>x2 then DO
  35.     x=x1
  36.     x1=x2
  37.     x2=x
  38. END
  39. IF y1>y2 then DO
  40.     y=y1
  41.     y1=y2
  42.     y2=y
  43. END
  44.  
  45.  
  46.     pp_CountFrames
  47.     nb=result
  48.     IF nb<2 then DO
  49.         pp_Warn 'Make*an*Anim*first.'
  50.         EXIT
  51.     END
  52.  
  53. if sens=0 THEN DO
  54.     DO x=x1 to x2
  55.         pp_Plot x y1
  56.         pp_NextFrame
  57.     END    
  58.  
  59.     DO y=y1+1 to y2
  60.         pp_Plot x2 y
  61.         pp_NextFrame
  62.     END
  63.  
  64.     DO x=x2-1 to x1 by -1
  65.         pp_Plot x y2
  66.         pp_NextFrame
  67.     END
  68.  
  69.     DO y=y2-1 to y1+1 by -1
  70.         pp_Plot x1 y
  71.         pp_NextFrame
  72.     END
  73. END
  74. ELSE
  75. DO
  76.     DO x=x2 to x1 by -1
  77.         pp_Plot x y1
  78.         pp_NextFrame
  79.     END    
  80.  
  81.     DO y=y1+1 to y2
  82.         pp_Plot x1 y
  83.         pp_NextFrame
  84.     END
  85.  
  86.     DO x=x1+1 to x2
  87.         pp_Plot x y2
  88.         pp_NextFrame
  89.     END
  90.  
  91.     DO y=y2-1 to y1+1 by -1
  92.         pp_Plot x2 y
  93.         pp_NextFrame
  94.     END
  95. END
  96.  
  97. EXIT
  98.  
  99. SavePrefs: PROCEDURE
  100.     
  101.     Prefname='PerfectPaint:Prefs/Rexx_Prefs/'||ARG(1)
  102.  
  103.     if EXISTS(Prefname) THEN DO
  104.         ADDRESS COMMAND
  105.         'delete >nil: '||Prefname
  106.     END
  107.  
  108.     IF OPEN('pfile',PrefName,'W') THEN DO
  109.  
  110.     do i=2 to ARG()
  111.         CALL WRITELN('pfile',ARG(i))
  112.     end
  113.  
  114.     CALL CLOSE('pfile')
  115.  
  116. RETURN
  117.